from peewee import *
from config.base_config import get_db
import datetime

db = get_db()


class TradeOrder(Model):
    id = IntegerField()
    plat = CharField()
    api_key = CharField()
    secret_key = CharField()
    passphrase = CharField()
    need_change = CharField()
    p_id = CharField()
    ord_id = CharField()
    inst_id = CharField()
    ord_type = CharField()
    pos_side = CharField()
    side = CharField()
    quantity = DecimalField()
    price = DecimalField()
    fee = DecimalField()
    create_time = DateTimeField(default=datetime.datetime.now())
    update_time = DateTimeField(default=datetime.datetime.now())
    status = IntegerField()
    err_msg = CharField()
    code = IntegerField()

    class Meta:
        database = db
        table_name = "trade_order"
